package net.zjitc.io.bufferedreader;

import javax.print.attribute.standard.NumberUp;
import java.io.*;

/**
 * @Author admin
 * @Date 2019/4/10 11:14
 */
public class Copyfile {
    public static void main(String[] args) {
        BufferedReader br = null;
        Reader in = null;
        BufferedWriter bw = null;
        Writer out = null;
        try {
            in = new FileReader("D:\\a.txt");
            br = new BufferedReader(in);
            out = new FileWriter("a.txt");
            bw = new BufferedWriter(out);
            String line;
            while ((line = br.readLine()) != null) {
                bw.write(line);
                bw.newLine();
            }
            bw.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null) {
                    br.close();
                }
                if (in != null) {
                    in.close();
                }
                if (bw != null) {
                    bw.close();
                }
                if (out != null) {
                    out.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
